<?php 
/**
* @orm tableName oneToOneParent
*/
class DomArOneToManyTestClass extends DomArObject {
	
	/**
	* @orm text
	*/
	public $name;
	/**
	* @orm owns children DomArOneToManyChildTestClass inverse parent
	*/
	public $children;
	
	/**
	* @orm has children DomArOneToManyChildTestClass inverse aggrParent
	*/
	public $aggrChildren;
	
	/**
	* @orm has parents DomArOneToManyChildTestClass inverse child
	*/
	public $parents;
	
	public function construct( $name ) {
		$this->name = $name;
	}

}

/**
* @orm tableName oneToOneChild
*/
class DomArOneToManyChildTestClass extends DomArObject {
	
	/**
	* @orm text
	*/
	public $name;
	/**
	* @orm has parent DomArOneToManyTestClass inverse children
	*/
	public $parent;
	
	/**
	* @orm has parent DomArOneToManyTestClass inverse aggrChildren
	*/
	public $aggrParent;
	
	/**
	* @orm has child DomArOneToManyTestClass inverse parents
	*/
	public $child;
	
	public function construct( $name ) {
		$this->name = $name;
	}
}

/**
* @orm tableName oneToOneChild
*/
class DomArOneToManyChildExtTestClass extends DomArOneToOneChildTestClass {

}



class DomArOneToManyVChild extends DomArObject {
	
	/**
	 * @orm text
	 */
	public $text;
	/**
	* @orm has many DomArOneToManyVChild inverse parent myValidator()
	*/
	public $items;
	/**
	* @orm has parent DomArOneToManyVChild inverse items
	* @orm validator method mySecondValidator
	*/
	public $parent;
	
	public function myValidator( $value, &$customParams ) {
		if( $value->text == 'good') {
			return 0;
		} else {
			$customParams['myParam'] = $value->text;
			return 29;
		}
	}
	
	public function mySecondValidator( $value, &$customParams ) {
		if( $value->text != 'main') {
			$customParams['myValue'] = $value->text;
			return 31;
		} else
			return 0;
	}
	
	public function getValidationErrorMessages() {
		return array(
			'items' => array(
				29 => 'I My error [$myParam]',
				31 => 'I Only main is allowed, [$myValue] was given',
			),
			'parent' => array(
				29 => 'P My error [$myParam]',
				31 => 'P Only main is allowed, [$myValue] was given',
			),
		);
	}
	
}
?>